package com.nuc.crp4;

/**
 * Time    : 2023/3/24 8:57
 * Author  : 王摇摆
 * FileName: RubberDuck.java
 * Software: IntelliJ IDEA 2020.2.2
 * Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
 */

public class RubberDuck extends Duck implements Quackable {
    private String name;

    public RubberDuck(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }


    @Override
    public void swim() {
        System.out.println(this.getName() + " can swim!");

    }

    @Override
    public void display() {
        System.out.println("I am " + this.getName() + "!");

    }

    @Override
    public void quack() {
        System.out.println(this.getName()+" can squeak squeak~");
    }
}
